#https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_video/py_bg_subtraction/py_bg_subtraction.html
import cv2
import numpy as np
winname='GRS'
fgbg = cv2.createBackgroundSubtractorMOG2()
capture=cv2.VideoCapture('vtest.avi')

if __name__=='__main__':
    while capture.isOpened():
        _,frame=capture.read()
        frame = fgbg.apply(frame)
        cv2.imshow(winname,frame)
        if cv2.waitKey(100) & 0xFF == ord('q'):
            break
